home *** CD-ROM | disk | FTP | other *** search
/ QRZ! Ham Radio 1 / QRZ Ham Radio Callsign Database - December 1993.iso / ucsd / packet / tcpip / sys5 / iscwmpst.z / iscwmpst / tcp / src / ax25.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-04-26  |  4.2 KB  |  132 lines

  1. /* @(#) $Header: ax25.h,v 1.7 91/04/25 18:26:35 deyke Exp $ */
  2.  
  3. #ifndef _AX25_H
  4. #define _AX25_H
  5.  
  6. #ifndef _GLOBAL_H
  7. #include "global.h"
  8. #endif
  9.  
  10. #ifndef _MBUF_H
  11. #include "mbuf.h"
  12. #endif
  13.  
  14. #ifndef _IFACE_H
  15. #include "iface.h"
  16. #endif
  17.  
  18. /* AX.25 datagram (address) sub-layer definitions */
  19.  
  20. #define MAXDIGIS        7       /* Maximum number of digipeaters */
  21. #define ALEN            6       /* Number of chars in callsign field */
  22. #define AXALEN          7       /* Total AX.25 address length, including SSID */
  23. #define AXBUF           10      /* Buffer size for maximum-length ascii call */
  24.  
  25. /* Bits within SSID field of AX.25 address */
  26. #define SSID            0x1e    /* Sub station ID */
  27. #define REPEATED        0x80    /* Has-been-repeated bit in repeater field */
  28. #define E               0x01    /* Address extension bit */
  29. #define C               0x80    /* Command/response designation */
  30. /* Our AX.25 address */
  31. extern char Mycall[AXALEN];
  32.  
  33. /* AX.25 broadcast address: "QST   -0" in shifted ASCII */
  34. extern char Ax25_bdcst[AXALEN];
  35.  
  36. extern int Digipeat;
  37.  
  38. /* Internal representation of an AX.25 header */
  39. struct ax25 {
  40.     char dest[AXALEN];              /* Destination address */
  41.     char source[AXALEN];            /* Source address */
  42.     char digis[MAXDIGIS][AXALEN];   /* Digi string */
  43.     int ndigis;                     /* Number of digipeaters */
  44.     int nextdigi;                   /* Index to next digi in chain */
  45.     int cmdrsp;                     /* Command/response */
  46. };
  47.  
  48. /* C-bit stuff */
  49. #define LAPB_UNKNOWN            0
  50. #define LAPB_COMMAND            1
  51. #define LAPB_RESPONSE           2
  52.  
  53. /* AX.25 routing table entry */
  54. struct ax_route {
  55.     char call[AXALEN];
  56.     struct ax_route *digi;
  57.     struct iface *ifp;
  58.     int perm;
  59.     long time;
  60.     struct ax_route *next;
  61. };
  62.  
  63. #define AXROUTESIZE     499
  64.  
  65. extern struct ax_route *Ax_routes[AXROUTESIZE];
  66. extern struct iface *axroute_default_ifp;
  67.  
  68. /* AX.25 Level 3 Protocol IDs (PIDs) */
  69. #define PID_X25         0x01    /* CCITT X.25 PLP */
  70. #define PID_SEGMENT     0x08    /* Segmentation fragment */
  71. #define PID_TEXNET      0xc3    /* TEXNET datagram protocol */
  72. #define PID_LQ          0xc4    /* Link quality protocol */
  73. #define PID_APPLETALK   0xca    /* Appletalk */
  74. #define PID_APPLEARP    0xcb    /* Appletalk ARP */
  75. #define PID_IP          0xcc    /* ARPA Internet Protocol */
  76. #define PID_ARP         0xcd    /* ARPA Address Resolution Protocol */
  77. #define PID_FLEXNET     0xce    /* FLEXNET */
  78. #define PID_NETROM      0xcf    /* NET/ROM */
  79. #define PID_NO_L3       0xf0    /* No level 3 protocol */
  80.  
  81. #define SEG_FIRST       0x80    /* First segment of a sequence */
  82. #define SEG_REM         0x7f    /* Mask for # segments remaining */
  83.  
  84. #define ismycall(call)   addreq(call, Mycall)
  85.  
  86. /* Linkage to network protocols atop ax25 */
  87. struct axlink {
  88.     int pid;
  89.     void (*funct) __ARGS((struct iface *,struct ax25_cb *,char *, char *,
  90.      struct mbuf *,int));
  91. };
  92. extern struct axlink Axlink[];
  93.  
  94. /* List of AX.25 multicast addresses */
  95. extern char *Axmulti[];
  96.  
  97. /* Codes for the open_ax call */
  98. #define AX_PASSIVE      0       /* not implemented */
  99. #define AX_ACTIVE       1
  100. #define AX_SERVER       2       /* Passive, clone on opening */
  101.  
  102. /* In ax25.c: */
  103. void ax_recv __ARGS((struct iface *,struct mbuf *));
  104. int ax_send __ARGS((struct mbuf *bp,struct iface *iface,int32 gateway,int prec,
  105.     int del,int tput,int rel));
  106. int ax_output __ARGS((struct iface *iface,char *dest,char *source,int pid,
  107.     struct mbuf *data));
  108. void axnl3 __ARGS((struct iface *iface,struct ax25_cb *axp,char *src,
  109.     char *dest,struct mbuf *bp,int mcast));
  110. struct ax_route *ax_routeptr __ARGS((char *call, int create));
  111. void axroute_add __ARGS((struct iface *iface, struct ax25 *hdr, int perm));
  112. void axroute __ARGS((struct ax25_cb *cp, struct mbuf *bp));
  113. char *ax25hdr_to_string __ARGS((struct ax25 *hdr));
  114.  
  115. /* In axhdr.c: */
  116. struct mbuf *htonax25 __ARGS((struct ax25 *hdr,struct mbuf *data));
  117. int ntohax25 __ARGS((struct ax25 *hdr,struct mbuf **bpp));
  118.  
  119. /* In ax25subr.c: */
  120. int addreq __ARGS((char *a,char *b));
  121. struct iface *ismyax25addr __ARGS((char *addr));
  122. void addrcp __ARGS((char *to,char *from));
  123. char *pax25 __ARGS((char *e,char *addr));
  124. int setcall __ARGS((char *out,char *call));
  125. int16 ftype __ARGS((int control));
  126.  
  127. /* In ax25file.c: */
  128. void axroute_savefile __ARGS((void));
  129. void axroute_loadfile __ARGS((void));
  130.  
  131. #endif  /* _AX25_H */
  132.